﻿@{
    var uri = Request.Url.GetLeftPart(System.UriPartial.Authority) + Url.Action("Index", "Task");
}

<meta name="application-name" content="MVC Task Manager" />
<meta name="msapplication-starturl" content="@uri"/>
<meta name="msapplication-navbutton-color" content="#5f6dbd" />
<meta content="name=New Task;
      action-uri=./Task/Create;
      icon-uri=./favicon.ico" name="msapplication-task" />
<script type="text/javascript">
    var g_ext = null;
    window.onload = function () {
        try {
            $.post("/Task/TaskSummary",
            function (data) {
                // Successful requests get here

                // Update the page elements
                if (window.external.msIsSiteMode()) {
                    g_ext = window.external;
                    g_ext.msSiteModeClearJumpList();
                    g_ext.msSiteModeCreateJumpList("Last Tasks");
                    for (var i = 5; i > 0; i--) {
                        g_ext.msSiteModeAddJumpListItem(
                            data[i].Description, "/" + data[i].CategoryId, "img/icon.ico");
                    }
                }
            });
        }
        catch (ex) {
            // Fail silently.
        }
    }

    function addSite() {
        try {
            window.external.msAddSiteMode();
        }
        catch (e) {
            alert("This feature is only available in Internet Explorer 9.");
        }
    }
</script>
